package com.bridgeintelligent.tag.mapper;

import com.bridgeintelligent.tag.bulkload.api.issue.CustomersChannel;
import com.bridgeintelligent.tag.bulkload.api.issue.IssueLog;
import com.bridgeintelligent.tag.bulkload.api.issue.IssueTaskLog;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @description
 * @author: grp 2021-03-04 21:57
 **/
@Mapper
public interface IssueTaskMapper {
    @Select("select * from TAG_CUSTOMERS_ISSUE_TASK_LOG where id = #{id}")
    IssueTaskLog findOneTaskLog(String id);
    @Select("select * from TAG_CUSTOMERS_ISSUE_LOG_INFO where id = #{id}")
    IssueLog findOneLog(String id);

    int update(IssueLog issueLog);

    @Delete("delete from TAG_CUSTOMERS_ISSUE_PENDING where log_id = #{id}")
    int deletePending(String id);

    @Select("select * from TAG_CUSTOMERS_ISSUE_CHANNEL where id = #{channelId}")
    CustomersChannel findChannel(String channelId);

    @Select("select count(1) from FCT_S_BATCH_LABEL where  BATCH_TYPE = #{batchType} and IS_RUNNING = 1 and LABEL_DATA_DATE = #{dataDate} and INDEX_ID = #{indexId}")
    int batchCount(int batchType,String dataDate,String indexId);

    @Select("select count(1) from TAG_MQ_RECORD where trans_num = #{transNum}")
    int transNum(String transNum);

    void addTransNum(String transNum);

    IssueTaskLog findIndexByCustomerId(@Param("customerId")String customerId);
}
